package com.skychyn.xml;

import java.util.Calendar;

public class ParsedWeatherDataSet {

	// ===========================================================
	// Fields
	// ===========================================================

	private Calendar forecastDate;

	private int maxPressure;
	private int minPressure;

	private int maxTemperature;
	private int minTemperature;

	// ===========================================================
	// Getters & setters
	// ===========================================================

	/**
	 * @return the forecastDate
	 */
	public Calendar getForecastDate() {
		return forecastDate;
	}

	/**
	 * @param forecastDate
	 *            the forecastDate to set
	 */
	public void setForecastDate(Calendar forecastDate) {
		this.forecastDate = forecastDate;
	}

	/**
	 * @return the maxPressure
	 */
	public int getMaxPressure() {
		return maxPressure;
	}

	/**
	 * @param maxPressure
	 *            the maxPressure to set
	 */
	public void setMaxPressure(int maxPressure) {
		this.maxPressure = maxPressure;
	}

	/**
	 * @return the minPressure
	 */
	public int getMinPressure() {
		return minPressure;
	}

	/**
	 * @param minPressure
	 *            the minPressure to set
	 */
	public void setMinPressure(int minPressure) {
		this.minPressure = minPressure;
	}

	/**
	 * @return the maxTemperature
	 */
	public int getMaxTemperature() {
		return maxTemperature;
	}

	/**
	 * @param maxTemperature
	 *            the maxTemperature to set
	 */
	public void setMaxTemperature(int maxTemperature) {
		this.maxTemperature = maxTemperature;
	}

	/**
	 * @return the minTemperature
	 */
	public int getMinTemperature() {
		return minTemperature;
	}

	/**
	 * @param minTemperature
	 *            the minTemperature to set
	 */
	public void setMinTemperature(int minTemperature) {
		this.minTemperature = minTemperature;
	}

	public int getTemperature() {
		return (maxTemperature + minTemperature) / 2;
	}

	public int getPressure() {
		return (maxPressure + minPressure) / 2;
	}

	// ===========================================================
	// Methods
	// ===========================================================

	public String toString() {
		return "Forecast (" + prepareDate() + ") = P: " + this.minPressure
				+ "/" + this.maxPressure + " T:" + this.minTemperature + "/"
				+ this.maxTemperature + ";\n";
	}

	public String prepareDate() {
		return forecastDate.getTime().toGMTString();
	}
}
